/*
 * Copyright (c) 2024 HiSilicon (Shanghai) Technologies CO., LIMITED.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Description: host heartbeat header file
 */

#ifndef __PLAT_HEARTBEAT_H__
#define __PLAT_HEARTBEAT_H__

#include "soc_osal.h"
#include "hcc_bus.h"

#define HCC_HEARTBEAT_MUTEX_TIMEOUT_MS  1000
#define HCC_HEARTBEAT_TIMER_INTERVAL_MS 1000
#define HCC_HEARTBEAT_ERROR_THRESHOLD   4
#define UINT32_MAX (0xffffffffu)

struct hcc_heartbeat_data {
    volatile osal_bool start;
    volatile osal_u32 check_cnt;
    osal_mutex lock;
    osal_timer timer;
    osal_workqueue workq;
};

osal_s32 hcc_heartbeat_device_enable(osal_void);
osal_s32 hcc_heartbeat_device_disable(osal_void);

osal_s32 hcc_heartbeat_start(osal_void);
osal_void hcc_heartbeat_stop(osal_void);
osal_s32 hcc_heartbeat_init(osal_void);
osal_void hcc_heartbeat_deinit(osal_void);

#endif
